import java.util.HashSet;
import java.util.Set;

class Solution {
    public boolean containsDuplicate(int[] nums) {
        Set<Integer> set = new HashSet<>();

        for (int x : nums) {
            if (!set.add(x)) {
                return true;
            }
        }

        return false;
    }

    // 主方法用于测试
    public static void main(String[] args) {
        Solution solution = new Solution();

        // 测试用例
        System.out.println(solution.containsDuplicate(new int[]{1, 2, 3, 4})); // false
        System.out.println(solution.containsDuplicate(new int[]{1, 2, 3, 3})); // true
    }
}